package android.moodle;

import android.app.Activity;
import android.javaClasses.DataHelper;
import android.javaClasses.Game;
import android.javaClasses.XmlHandler;
import android.os.Bundle;
import android.util.Log;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: michelle
 * Date: 4/14/11
 * Time: 12:26 PM
 * To change this template use File | Settings | File Templates.
 */
public class TestActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_screen);
        /*
        TableLayout table = (TableLayout)findViewById(R.id.scoresTable);

        DataHelper data = new DataHelper(this);
        XmlHandler handler = new XmlHandler(this, table);

        String winner = "Alexander";
        String[] players = {"Alexander", "Michelle"};
        Game aGame = new Game(players, winner);
        data.insert(aGame);

        ArrayList<Game> games = data.selectAll();
        for(Game game : games) {
            handler.addTextToRow(game.getPlayers(), game.getWinner());
            Log.i("winner", game.getWinner());

        }  */

        /*XmlHandler handler = new XmlHandler(this);

        String winner = "Alexander";
        String[] players = {"Alexander", "Michelle"};

        //handler.deleteScoreFile();

        handler.writeToXml(players, winner);
        */


        Animation anim = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
        Animation anim2 = AnimationUtils.loadAnimation(this, R.anim.diagonal);

        TableRow row1 = (TableRow)findViewById(R.id.row1);
        TableRow row2 = (TableRow)findViewById(R.id.row2);
        TableRow row3 = (TableRow)findViewById(R.id.row3);
        row1.startAnimation(anim);
        row2.startAnimation(anim);
        row3.startAnimation(anim);

        ImageView img1 = (ImageView)findViewById(R.id.img3Row1);
        ImageView img2 = (ImageView)findViewById(R.id.img2Row2);
        ImageView img3 = (ImageView)findViewById(R.id.img1Row3);

        anim2.setStartOffset(2000);
        img1.startAnimation(anim2);
        img2.startAnimation(anim2);
        img3.startAnimation(anim2);

        Animation fadeIn = AnimationUtils.loadAnimation(this, R.anim.fade_in);
        TextView madeBy = (TextView)findViewById(R.id.madeBy);
        fadeIn.setStartTime(5000);
        madeBy.startAnimation(fadeIn);



    }
}